<?php
class Application_Model_User {
	const ADMIN = 'admin';
	const USER = 'user';
	const GUEST = 'guest';
	
	protected $_isAdmin = false;
	protected $_priceScheme = 0;
	protected $_login = null;
	
	public function getLogin() {
		return $this->_login;
	}
	public function getPriceScheme() {
		return ( bool ) $this->_priceScheme ? "price_1" : "price_2";
	}
	public function isAdmin() {
		return $this->_isAdmin;
	}
	
	public function setLogin($login) {
		$this->_login = $login;
	}
	public function setPriceScheme($scheme) {
		$this->_priceScheme = $scheme;
	}
	public function setAdmin() {
		$this->_isAdmin = true;
	}
	
	public function __construct($login = null, $priceScheme = null, $isAdmin = false) {
		$this->setLogin ( $login );
		$this->setPriceScheme ( $priceScheme );
		if ($isAdmin)
			$this->setAdmin ();
	}
	
	public function getRole() {
		if ($this->_isAdmin)
			return self::ADMIN;
		if (! is_null ( $this->_login ))
			return self::USER;
		return self::GUEST;
	}
	
	public function isGuest() {
		return $this->getRole () === self::GUEST;
	}
} 